|
CAN Gateway code example
v1.2
|
Namespace for cangw module. More...
Typedefs | |
| typedef void(* | RcvCb_t )(const J2534::PASSTHRU_MSG *rxPassThruMsg, unsigned long rxMsgNum) |
| Definition of callback function for receive frames. | |
Enumerations | |
| enum | ErrCode_e { CAN_GW_OK, CAN_GW_ERR } |
| Definition of CAN Gateway's error codes. More... | |
| enum | Channel_e { CHANNEL_1, CHANNEL_2 } |
| Definition of CAN Gateway channels' names. More... | |
| enum | Baudrate_e { BAUD_125K, BAUD_250K, BAUD_500K, BAUD_1M } |
| Definition of CAN Gateway's baud rates. More... | |
Functions | |
| ErrCode_e | init (Baudrate_e baudChan1, Baudrate_e baudChan2, const RcvCb_t cbChan1, const RcvCb_t cbChan2) |
| Function initializes CAN Gateway device. More... | |
| ErrCode_e | uninit () |
| Function uninitializes CAN Gateway device. More... | |
| ErrCode_e | send (Channel_e channel, J2534::PASSTHRU_MSG *txPassThruMsg) |
| Function sends PASSTHRU frame via given channel. More... | |
| ErrCode_e | startPeriodic (Channel_e channel, J2534::PASSTHRU_MSG *txPassThruMsg, unsigned long interval) |
| Function starts CAN Gateway's periodic message. More... | |
Namespace for cangw module.
| enum canGw::ErrCode_e |
| enum canGw::Channel_e |
| enum canGw::Baudrate_e |
| ErrCode_e canGw::init | ( | Baudrate_e | baudChan1, |
| Baudrate_e | baudChan2, | ||
| const RcvCb_t | cbChan1, | ||
| const RcvCb_t | cbChan2 | ||
| ) |
Function initializes CAN Gateway device.
| [in] | baudChan1 | Baud rate for physical channel 1 |
| [in] | baudChan2 | Baud rate for physical channel 2 |
| [in] | cbChan1 | Callback function for receive on physical channel 1 |
| [in] | cbChan2 | Callback function for receive on physical channel 2 |
Definition at line 124 of file cangw.cpp.
References BAUD_125K, BAUD_1M, BAUD_250K, BAUD_500K, BAUD_VAL_125KBPS, BAUD_VAL_1MBPS, BAUD_VAL_250KBPS, BAUD_VAL_500KBPS, GwParam_s::baudCh1, GwParam_s::baudCh2, CAN_GW_ERR, CAN_GW_OK, canGwInitRcvThread(), canGwOpen(), CHANNEL_1, CHANNEL_2, gwParam, MAX_RX_MSGS, rcvCbCh1, rcvCbCh2, rxPassThruMsgCh1, and rxPassThruMsgCh2.
Referenced by main().
| ErrCode_e canGw::uninit | ( | ) |
Function uninitializes CAN Gateway device.
Definition at line 201 of file cangw.cpp.
References CAN_GW_OK, canGwClose(), canGwUninitRcvThread(), CHANNEL_1, CHANNEL_2, rxPassThruMsgCh1, and rxPassThruMsgCh2.
Referenced by main().
Function sends PASSTHRU frame via given channel.
| [in] | channel | Physical channel to be used for sending of a message |
| [in] | txPassThruMsg | Pointer to a message to be sent |
Definition at line 228 of file cangw.cpp.
References CAN_GW_ERR, CAN_GW_OK, CHANNEL_1, CHANNEL_2, gwMutex, gwParam, GwParam_s::idCh1, GwParam_s::idCh2, and TX_TIMEOUT.
Referenced by main().
| ErrCode_e canGw::startPeriodic | ( | Channel_e | channel, |
| J2534::PASSTHRU_MSG * | txPassThruMsg, | ||
| unsigned long | interval | ||
| ) |
Function starts CAN Gateway's periodic message.
| [in] | channel | Physical channel to be used for sending of a periodic message |
| [in] | txPassThruMsg | Pointer to a message to be sent periodically |
| [in] | interval | Interval for a periodic message in miliseconds |
Definition at line 263 of file cangw.cpp.
References CAN_GW_ERR, CAN_GW_OK, CHANNEL_1, CHANNEL_2, gwMutex, gwParam, GwParam_s::idCh1, and GwParam_s::idCh2.
Referenced by main().
1.8.6